package cn.xiqi.cms.beans;

import cn.xiqi.cms.hibernate.DAO.AccountDAO;
import cn.xiqi.cms.hibernate.DAO.AccountDAOImpl;
import cn.xiqi.cms.hibernate.beans.Accountinfo;
import cn.xiqi.cms.hibernate.beans.Usrinfo;
import cn.xiqi.cms.hibernate.service.AccountService;
import cn.xiqi.cms.hibernate.service.AccountServiceImpl;

public class UserBean {
	private int userid;
	private int accountid;
	private String account;
	private String name;
	private int sex;
	private int depart;
	private int role;
	private int level;
	private int stat;
	
	public UserBean(Usrinfo record) {
		AccountDAO dao = new AccountDAOImpl();
		AccountService service = new AccountServiceImpl();
		Accountinfo account;
		
		service.setDao(dao);
		this.userid = record.getUsrID();
		account = service.getByUsr(this.userid);
		this.accountid = account.getAccountID();
		this.account = account.getUsername();
		this.name = record.getName();
		this.setSex(record.getSex());
		this.setDepart(record.getDepart());
		//TODO 从数据字典中取值
		this.setRole(record.getRoleID());
		//TODO 从数据字典中取值
		this.setLevel(record.getLevel());
		this.stat = record.getStat();
	}
	public int getUserid() {
		return userid;
	}
	public void setUserid(int userid) {
		this.userid = userid;
	}
	public int getAccountid() {
		return accountid;
	}
	public void setAccountid(int accountid) {
		this.accountid = accountid;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getStat() {
		return stat;
	}
	public void setStat(int stat) {
		this.stat = stat;
	}
	public String getAccount() {
		return account;
	}
	public void setAccount(String account) {
		this.account = account;
	}
	public int getSex() {
		return sex;
	}
	public void setSex(int sex) {
		this.sex = sex;
	}
	public int getDepart() {
		return depart;
	}
	public void setDepart(int depart) {
		this.depart = depart;
	}
	public int getRole() {
		return role;
	}
	public void setRole(int role) {
		this.role = role;
	}
	public int getLevel() {
		return level;
	}
	public void setLevel(int level) {
		this.level = level;
	}
}
